package com.budwk.app.sqfwV2.enums;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.util.poiUtils.nutzBeanUtils.NutzIocUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Date;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum AuthenticRightEnum {
    A(1,"案件确权","/baiyunqv/ajqq.docx","{}{}","/templet/现场确权通知.docx","/preview/au/img-12345-notice.png"),
    B(2,"实地回访","/baiyunqv/sdhf.docx","{}案件实地回访表","/templet/白云区12345热线案件办理实地核查表.docx","/preview/au/2.png"),
    C(3,"会议协调","/baiyunqv/ajqq.docx,/baiyunqv/hyxt1.docx,/baiyunqv/hyxt2.docx","{}案件汇总表","/templet/汇总表.docx","/preview/au/3.jpg"),
    D(4,"会议协调","/baiyunqv/hyxttz.xlsx","会议协调情况台账","/templet/会议协调情况台账.xlsx","/preview/au/img-12345-taizhang.png"),
    E(5,"实地回访","/baiyunqv/sdhftz.xlsx","12345案件实地回访表台账","/templet/12345案件实地回访表.xlsx","/preview/au/5.png");
    private  int code;
    private  String name;
    private  String templat;
    private  String fileName;
    private  String blankTemplate;
    private  String previewImage;
    public static String getPdfTemplatName(String name){
        String templat = Arrays.asList(AuthenticRightEnum.values())
                .stream()
                .filter(e -> name .equals(e.getName())&&e.getCode()<=3 )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }

    public static String getExcelTemplatName(Integer code){
        String templat = Arrays.asList(AuthenticRightEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()))
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }

    public static String getFileName(String name){
        String filename = Arrays.asList(AuthenticRightEnum.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return filename;
    }

    public static String getName(Integer code){
        String name = Arrays.asList(AuthenticRightEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getName();
        return name;
    }
    public static String getBlankTemplate(Integer code){
        String blankTemplate = Arrays.asList(AuthenticRightEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getBlankTemplate();
        return NutzIocUtils.getOssPrefix()+blankTemplate;
    }

    public static String getFileName(Integer code){
        String fileName = Arrays.asList(AuthenticRightEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return fileName;
    }

}
